package com.thinkingstar.iads.datacenter.entity.dao;

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.QueryResult;
import org.nutz.dao.pager.Pager;
import org.nutz.dao.sql.Criteria;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.Param;

import com.thinkingstar.iads.common.serviceImpl.EntityRepositoryServiceImpl;
import com.thinkingstar.iads.datacenter.entity.DcManufacturerEquipment;
import com.thinkingstar.iads.datacenter.entity.DcMileageLibrary;


/**
 * @ClassName: DaoDcMileageLibrary 
 * @Description:数据中心_站站里程数据库
 * @author 1157372219@qq.com 
 * @date 2018年3月19日   
 */
@IocBean(args = {"refer:dao"})
public class DaoDcMileageLibrary extends EntityRepositoryServiceImpl<DcMileageLibrary>{

	public DaoDcMileageLibrary(Dao dao) {
		super(dao);
	}
	
	//车站里程数据库
	public QueryResult findCzMileageLibrary(@Param("..") NutMap param){
		Pager pager = null;
		List <DcMileageLibrary> list = null;
		Criteria criteria = Cnd.NEW();
		if(StringUtils.isNotBlank(param.getString("origin"))){
			criteria.where().and("origin", "=", param.getString("origin"));
		}
		criteria.getOrderBy().asc("serial_number+0");
		if(param.get("page_num") != null && param.get("page_size") != null){
			pager = new Pager(param.getInt("page_num"), param.getInt("page_size"));
			pager.setRecordCount(count(criteria));
			list = query(criteria, pager);
		}else{
			list = query(criteria);
		}
		return new QueryResult(list, pager);
	}
	

}
